<template>
    <div>
        <Input v-model="filterText" placeholder="请输入关键字进行搜索" />
        <Tree :data="category" @on-select-change="treeSelect"></Tree>
    </div>
</template>

<script>
import * as ApiCate from "@/api/myapi/Cate"
export default {
    data() {
        return {
            // 搜索输入框绑定
            filterText: "",
            // 三级分类菜单
            category: [],
            
        }
    },
    methods: {
        initCate() {
            let data = [];
            ApiCate.getCateTreeComponent().then(res => {
                if (res.data.code == 201) {
                    this.category = res.data.obj
                };
            })
        },
        treeSelect(item){
            if(item.catLevel=3){
                this.$emit("cateTreeCompontSelect",item);
            }
        }
    },
    created() {
        this.initCate();
    }
}
</script>

<style>

</style>